package java8.lamb;

import java.util.*;

/**
 * Created by fangjicai on 2020/6/6.
 */
public class LambdaTest {
    public static void main(String[] args) {
        //oldApiTest();
        lambdaApi();
    }
    public static  void oldApiTest(){
        List<String> names= Arrays.asList("perter","anana","mike");
        Collections.sort(names, new Comparator<String>() {
            @Override
            public int compare(String a, String b) {
                return b.compareTo(a);
            }
        });
        System.out.println(names);
    }

    public static void lambdaApi(){
        List<String> names= Arrays.asList("perter","anana","mike");
        //Collections.sort(names,(String a,String b)->{return b.compareTo(a);});
        Collections.sort(names,(a,b)->b.compareTo(a));
        System.out.println(names);
    }
}
